package com.cykj.cotroller;

import com.cykj.dto.ResponseDto;
import com.cykj.service.RegisterService;
import com.cykj.vo.registerVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Transactional
@RequestMapping("/reg")
public class RegisterController  {
    @Autowired
    private RegisterService registerService;
    @RequestMapping("register")
    @ResponseBody
    public ResponseDto register(@RequestBody registerVo vo){
        int register = registerService.Register(vo.getUserName(),vo.getUserNumber(), vo.getUserPwd(), vo.getUserSex(), vo.getUserAge(), vo.getUserIdNumber(), vo.getUserWeight(), vo.getUserHeight());
        if(register!=-1){
            return new ResponseDto(1,"注册成功",register);
        }else {
            return new ResponseDto(0,"注册失败",register);
        }
    }
}
